       # akshare代码到tushare代码的映射
INDEX_CODE_MAP = {
    'sh000001': '000001.SH',  # 上证指数
    'sz399001': '399001.SZ',  # 深证成指
    'sz399006': '399006.SZ',  # 创业板指
    'sz399300': '000300.SH'   # 沪深300
}

def get_tushare_code( ak_code):
    """将akshare代码转换为tushare代码"""
    return INDEX_CODE_MAP.get(ak_code, ak_code)

def get_akshare_code(ts_code):
    """将tushare代码转换为akshare代码"""
    reverse_map = {v: k for k, v in INDEX_CODE_MAP.items()}
    return reverse_map.get(ts_code, ts_code)